package cn.chaohi.controller;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import cn.chaohi.common.CodeEnum;
import cn.chaohi.controller.model.report.ReportStatusReq;
import cn.chaohi.model.Result;
import cn.chaohi.service.ReportStatusService;

/**
 * 升级/下载状态上报
 * @author James-Yin
 */
@RestController
@RequestMapping("/api/report")
public class ReportStatusController {
	
    @Autowired
    private ReportStatusService reportStatusService;
    
    private Logger logger = Logger.getLogger(ReportStatusController.class);
    
    /**
     * 升级/下载状态上报
     * @return
     * @throws Exception 
     */
    @RequestMapping("/reportStatus")
    public Result reportStatus(@RequestBody ReportStatusReq reportStatusReq) throws Exception {
    	
    	//logger.info("request parames: " + JSON.toJSONString(reportStatusReq));
    	
    	//请求参数为空check
    	reportStatusReq.validate();
    	reportStatusService.reportStatusSave(reportStatusReq);
        return new Result(CodeEnum.SUCCESS);
    }

}
